-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upgrade testing supports #9770
upgrade testing supports #9770
Conversation
ef9165a
to
f44917f
Compare
Deploying agoric-sdk with Cloudflare Pages
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files
|
f44917f
to
d374cd2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice.
I'm not 100% confident that I grok "feat: defer inbound bridge messages" fully but I suppose the tests show that it works.
/** | ||
* Elaboration of EVProxy with knowledge of bootstrap space in these tests. | ||
*/ | ||
type BootstrapEV = EProxy & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.ts 🥷
userSeat: ERef<UserSeat>; | ||
userSeat: Promise<UserSeat>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This excludes a remote presence for a UserSeat. That doesn't seem right. But I guess it could be a promise, so any consumers have to await it anyway. so close enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERef
is just T | Promise<T>
and it's never just T
. The remoteness is handled elsewhere.
@@ -40,7 +41,7 @@ import type { MsgDelegateResponse } from '@agoric/cosmic-proto/cosmos/staking/v1 | |||
import type { CoreEvalSDKType } from '@agoric/cosmic-proto/swingset/swingset.js'; | |||
import type { EconomyBootstrapPowers } from '@agoric/inter-protocol/src/proposals/econ-behaviors.js'; | |||
import type { SwingsetController } from '@agoric/swingset-vat/src/controller/controller.js'; | |||
import type { BridgeHandler, IBCMethod } from '@agoric/vats'; | |||
import type { BridgeHandler, IBCMethod, IBCPacket } from '@agoric/vats'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The vats package is really bursting at the seams, isn't it?
I wonder what it would cost to move IBCMethod, IBCPacket to network.
packages/boot/tools/supports.ts
Outdated
// This is what it used to do but that's not valid because bridge responses | ||
// aren't instantaneous. | ||
// inbound(BridgeId.DIBC, icaMocks.channelOpenAck(obj)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want to keep this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for code review. I'll drop it
|
||
t.log('restart stakeAtom'); | ||
await evalProposal( | ||
buildProposal('@agoric/builders/scripts/testing/restart-stakeAtom.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
// import dynamically so the module can work in CoreEval environment | ||
const dspModule = await import('@agoric/deploy-script-support'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting... I wonder how this doesn't run afoul of the SES prohibition on dynamic import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe agoric run
isn't locked down so much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this whole module is bundled for use as the actual core-eval.
I suppose the import()
gets "de-fanged" by deploy-script-support. It would probably fail if we tried to run this part of the code on-chain, but we don't.
d374cd2
to
ab8f679
Compare
@@ -371,8 +371,10 @@ type ChainBootstrapSpaceT = { | |||
namesByAddress: import('../types.js').NameHub; | |||
namesByAddressAdmin: import('../types.js').NamesByAddressAdmin; | |||
networkVat: NetworkVat; | |||
orchestration?: CosmosInterchainService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orchestration?: CosmosInterchainService; | |
cosmosInterchainService?: CosmosInterchainService; | |
orchestrationVat?: OrchestrationVat; |
In light of #9668
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a bigger change than just the typedef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we don't have orchestration
in chain bootstrap space anymore? But, these two are there?
* @param {ZCFSeat} seat | ||
* @param {{ chainNames: string[] }} offerArgs | ||
*/ | ||
const makePortfolioAcctHandler = async ( | ||
orch, | ||
makePortfolioHolder, | ||
{ makePortfolioHolder }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had this in mind with the original implementation: #9591 (comment)
But that is platform code and this is an example contract. So, don't see any harm here
const cosmosAccount = await remoteChain.makeAccount(); | ||
return cosmosAccount.asContinuingOffer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you find yourself needing to make fixups, mind including this drive-by?
- * Create an account on a Cosmos chain and return a continuing offer with
- * invitations makers for Delegate, WithdrawRewards, Transfer, etc.
+ * Create an OrchestrationAccount for a specific chain and return a continuing
+ * offer with invitations makers for Delegate, WithdrawRewards, Transfer, etc.
*
* @satisfies {OrchestrationFlow}
* @param {Orchestrator} orch
@@ -30,8 +30,8 @@ const makeOrchAccountHandler = async (orch, _ctx, seat, { chainName }) => {
seat.exit(); // no funds exchanged
mustMatch(chainName, M.string());
const remoteChain = await orch.getChain(chainName);
- const cosmosAccount = await remoteChain.makeAccount();
- return cosmosAccount.asContinuingOffer();
+ const orchAccount = await remoteChain.makeAccount();
+ return orchAccount.asContinuingOffer();
};
{ makePortfolioHolder }, | ||
makePortfolioAcctHandler, | ||
); | ||
const orchFns = orchestrateAll(flows, { makePortfolioHolder }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These have different contexts - so it seems like 2x orchestrate
is worth the cost here? Seems like it'll also be good to have examples using both orchestrateAll
and orchestrate
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I vacillated on this but I don't see how providing makePortfolioHolder
to both is a risk.
I think orchestrateAll
is what we should steer people to in general because it gets the durable from a named export, which changing is known to break downstream, whereas the string argument was easily confused as a debugging name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 the second argument is convincing
setTimeout(() => { | ||
/** | ||
* Mock when Agoric receives the ack from another chain over DIBC. Always | ||
* happens after the packet is returned. | ||
*/ | ||
inbound(BridgeId.DIBC, msg); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice use of setTimeout here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ambient authority grumble...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ambient authority in a mock.
setTimeout(() => { | ||
/** | ||
* Mock when Agoric receives the ack from another chain over DIBC. Always | ||
* happens after the packet is returned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also make a similar change in:
- packages/orchestration/test/network-fakes.ts
- packages/vats/tools/fake-bridge.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose so. WDYT @michaelfig ?
@@ -190,6 +197,7 @@ test.serial('stakeAtom - smart wallet', async t => { | |||
encoding: 'bech32', | |||
}; | |||
|
|||
// This will trigger the immediate ack of the mock bridge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is "This" related to It seems to be due to executeOffer
?ackImmediately
. Please consider making this comment more explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to word it in a way that wouldn't be false if that code was refactored
ab8f679
to
07cf2e9
Compare
fixup! chore(types): userSeat is Remote
07cf2e9
to
816099a
Compare
refs: #9303
Description
A bunch of refactors and testing utilities to support #9303.
It also adds a couple upgrade tests of orchestration contracts, but neither of them cover restarting orchestration flows so I'll leave #9755 for that.
Security Considerations
none
Scaling Considerations
none
Documentation Considerations
none
Testing Considerations
per se
Upgrade Considerations
Helps to test upgrades, should not affect any.